/*
   Copyright 2009 Abdulla Abdurakhmanov (abdulla@latestbit.com)
   Original sources are available at www.latestbit.com

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

package org.latestbit.smartobjects.network;

import java.net.URI;
import java.util.Collection;

/**
 * Endpoint location contains all network addresses (URI's) where this endpoint can be resolved 
 * and coordinator algorithm processing this endpoint  
 * @author abdulla-a
 *
 */
public interface IEndpointLocation {
	/**
	 * Gets current network address list
	 * @return network address list
	 */
	public Collection<URI> getLocations();
	
	/**
	 * Sets the new network address list
	 * @param locations network address list
	 */
	public void setLocations(Collection<URI> locations);
	
	/**
	 * Sets coordinator name
	 * @param coordinatorName coordinator name
	 */
	public void setCoordinator(String coordinatorName);
	
	/**
	 * Gets coordinator name
	 * @return coordinator name
	 */
	public String getCoordinator();
	
	/**
	 * Formats to string reference all endpoint information in format:
	 * [ Coordinator name { ] <host:port> [ ; <host:port ] [ } ], where [] is optional element
	 * @return reference in string form 
	 */
	public String toStringReference();
	
	/** 
	 * @see IEndpointLocation#toStringReference
	 */
	public String toString();
}
